/*
 * @Description:
 * @Version: 2.0
 * @Autor: wiz
 * @Date: 2022-08-04 18:07:16
 * @LastEditors: swc
 * @LastEditTime: 2024-01-20 09:54:04
 */
/* eslint-disable max-classes-per-file */
/*

//查询
{
	type:"query" // new modify delete query
	tableName:""
	params:{
		filter:{"$and":[{},{}]},
	    options:{
				fields:[{"_id":0}], // fields[] 为全布字段  mongo表达法 0表示不显示 1表示显示 
				sort:[{"a":1}],   1正序 -1倒序
				pageSize:10,
				pageNo:1
		}
		data:{}
	}
}
//更新
{
	type:"modify" // new modify delete query
	tableName:""
	params:{
		filter:{"$and":[{},{}]},
	    options:{}
		data:{
			"$set":{"a":1,"a.b":2}
		}
	}
}
//删除
{
	type:"delete" // new modify delete query
	tableName:""
	params:{
		filter:{"$and":[{},{}]},
	    options:{}
		data:{}
	}
}

//新增
{
	type:"new" // new modify delete query
	tableName:""
	params:{
		filter:{},
	    options:{}
		data:{
			arr:[
				{},{}
			]
		}
	}
}
*/
import lexicon from '@/lib/lexicon';
import * as tvs from '../../typeValue';
// 参数
export class T_ruleParams {
  // 过滤内容
  filter: any;

  // 选项
  options: any;

  // 存入
  data: any;
}
export interface I_ruleParams extends T_ruleParams {}

// mongoDB api请求
export class T_ruleReq {
  private url: string = lexicon.url.rule;

  tableName: string;

  type: tvs.V_CURD;

  // new modify delete query
  params: I_ruleParams;

  constructor() {
    this.params = new T_ruleParams();
  }

  public setTableName(p: string): T_ruleReq {
    this.tableName = p;
    return this;
  }

  public setType(p: tvs.V_CURD): T_ruleReq {
    this.type = p;
    return this;
  }

  public setParams(p: I_ruleParams): T_ruleReq {
    this.params = p;
    return this;
  }
}
export interface I_ruleReq extends T_ruleReq {}
